package be.kuleuven.mume.framework;

import java.io.Serializable;

public class Antwoord implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = -6738863529849165758L;
	public static final String URL = Mobilenvi.getSingelton().BASEURL + "/api/antwoord";
	public static final String URL_ADD = URL + "/add";
	public static final String URL_UPDATE = URL + "/update";
	public static final String ANTWOORD = "antwoord";
	
	private String id;
	private String text;
	private String vraagId;
	
	public Antwoord(){
		
	}
	
	public Antwoord(String text, String vraagId) {
		setText(text);
		setVraagId(vraagId);
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}
	
	public boolean hasId(){
		if(this.id == null || this.id.equals(""))
			return false;
		return true;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public String getVraagId() {
		return vraagId;
	}

	public void setVraagId(String vraagId) {
		this.vraagId = vraagId;
	}

	public static String getUrl(String vraagId) {
		return URL + "/" + vraagId;
	}
	
	@Override
	public boolean equals(Object o) {
		if(!this.hasId())
			return false;
		
		if(Antwoord.class.isInstance(o)) {
			return this.getId().equals(((Antwoord)o).getId());
		}
		return false;
	}
	
}
